<!DOCTYPE html>
<html lang="zh_CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>红心交互</title>
  </head>
  <style>
    * {
      padding: 0px;
      margin: 0px;
    }
    body {
      background: #95a5a6;
      overflow: hidden;
    }
    main {
      display: grid;
      height: 100vh;
      position: relative;
    }
    .heart-box {
      justify-self: center;
      align-self: center;
      position: absolute;
    }
    .heart-box > .heart-div {
      width: 50px;
      height: 50px;
      background: #d35400;
      position: relative;
      transform: rotate(45deg);
    }
    .heart-box > .heart-div::before {
      content: '';
      width: 50px;
      height: 50px;
      background: #d35400;
      position: absolute;
      border-radius: 50%;
      transform: translateX(-25px);
    }
    .heart-box > .heart-div::after {
      content: '';
      width: 50px;
      height: 50px;
      background: #d35400;
      position: absolute;
      border-radius: 50%;
      transform: translateY(-25px);
    }
    .entity {
      z-index: 2;
      cursor: pointer;
      transition-duration: 0s;
    }
    .entity-interactive {
      transition-duration: 0.5s;
      transform: scale(3);
      opacity: 0;
    }
  </style>
  <body>
    <main>
      <div class="heart-box entity" onclick="clickInteractive(this)">
        <div class="heart-div"></div>
      </div>
      <div class="heart-box">
        <div class="heart-div"></div>
      </div>
    </main>
    <script>
      function clickInteractive(event) {
        let classArray = [...event.classList]
        if (!classArray.includes('entity-interactive')) {
          event.classList.add('entity-interactive')
        }
        event.addEventListener('transitionend', function () {
          event.classList.remove('entity-interactive')
        })
      }
    </script>
  </body>
</html>
